package org.wdh.ep.nullflag.bf;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.Iterator;

public class BufferedReaderIterator implements Iterator {
	private BufferedReader internal;
	public BufferedReaderIterator(BufferedReader _internal) {
	this.internal = _internal;
	}
	public boolean hasNext() {
		try {
			boolean result = true;
			internal.mark(80);
			if(this.next() == null) {
				result = false;
			}
			return result;
		}
		catch(IOException e) {
			System.err.println(e.toString());
			return false;
		}
	}
	public Object next() {
		try {
			return internal.readLine();
		}
		catch (IOException e) {
			System.err.println(e.toString());
			return null;
		}
	}
	public void remove() {
		 throw new UnsupportedOperationException();
	}
}
